/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-09-01
 * Time: 21:20
 */
public class Test333 {
    static class Food{

    }
    static class Fruit extends Food{

    }
    static class Apple extends Fruit{

    }

    static class Message<T>{
        private T message;

        public T getMessage() {
            return message;
        }

        public void setMessage(T message) {
            this.message = message;
        }
    }
    public static void main(String[] args) {
        Message<Food> message=new Message<>();
        message.setMessage(new Food());
        fun(message);
    }
    public static void fun(Message<? super Fruit> temp){
        Fruit fruit=temp.getMessage();//不能被接收
        temp.setMessage(new Apple());//这个是Fruit的子类
        System.out.println(temp.getMessage());//只能直接输出


    }
}

